$(function(){
	var videoUrl = getParamByKey('videoUrl');
//	if(!videoUrl)	videoUrl="http://7xkmde.dl1.z0.glb.clouddn.com/xdf20150817/3847.mp4";
	setPlayer(videoUrl);
	//不能播放的提示
	var state=getParamByKey('video_state'); 
	if(state){
		switch(state){
			case 'a':$("#videoState").text("正在转码审核，请稍后再试");break;
			case 'b':$("#videoState").text("审核失败，无法播放");break;
		}		
	}	
//	setWH();
//	window.onresize=function(){
//		setWH();
//	};
});

/**
 * 得到参数
 * @param {String} 键值
 */
function getParamByKey(name){
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r !== null) return unescape(r[2]); return null;
}

/**
 * 初始化播放器
 * @param {String} 视频url
 */
function setPlayer(videoUrl){
	var flashvars={
		f:videoUrl,
		c:0,
        p:1,
        v:100,
        h:3,
        my_url:encodeURIComponent(window.location.href), 
        my_title:encodeURIComponent(document.title),
        loaded:'loadedHandler',
        b:0	
	};
	
	var h5video=[videoUrl];   
	CKobject.embed(
		'lib/ckplayer/ckplayer.swf',
		'a1',
		'myplayer',
		'100%',
		'100%',
		false,
		flashvars,
		h5video
	);
//	    SewisePlayer.setup({
//          server: "vod",
//          type: "mp4",
//          videourl: videoUrl,
//          skin: "vodTransparent",
//          title: "",
//          lang: 'zh_CN',
//          autostart:'true',
//          logo:'http://www.howdo.cc'   //隐藏右上角的水印图标
////          fallbackurls:{
////              ogg: "http://jackzhang1204.github.io/materials/mov_bbb.ogg",
////              webm: "http://jackzhang1204.github.io/materials/mov_bbb.webm"
////          }
//      });
}

//屏幕宽高适应
//function setWH(){
//	var getH=document.body.clientHeight;	
//	$("#a1").css('height',getH);	console.log(getH);
//}
//设置广告内容
//function ckmarqueeadv(){
//	return '{font color="#FFFFFF" size="12"}这里是好度的广告！~~{/font}';
//}

